<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import="com.tjtt.tdm.base.PubMethod" %>
<%@ page language="java" import="com.tjtt.common.utils.DateUtilsAll"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">   
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
  <head>
  <base target="_self"/>
  
  <title>选择审核人员</title>
  	<%@ include file="../jslib/jquerylib.jsp" %> 
	<link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
    <script type="text/javascript" src="<%=path %>/jslib/jquery.validate.min.js"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/My97DatePicker/WdatePicker.js"  defer="defer"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/jquery.form.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/additional-methods.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css" />
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/lhgdialog/lhgcore.lhgdialog.min.js?skin=mac"></script>

    <c:if test="${requestScope.message!=null}">
		<script type="text/javascript">
 	 		     alert('<c:out value="${requestScope.message}"></c:out>');
 	 		     window.close();
 		</script>
	</c:if> 
    <script type="text/javascript">
    var api = frameElement.api, W = api.opener;
    var stateValue="";
    $().ready(function(){
    	if("0"==${view}){
	        	for (i = 0;i < document.all.length; i++)
				{
					if (document.all[i].type == 'button' || document.all[i].type == 'submit' || document.all[i].type == 'reset')
					{
						document.all[i].style.display = "none";
					}
				}	
				document.getElementById("closeBtn").style.display="block";
	        }
	        shengchengyangpinno();
		//样品列表
		  $("#gridTableSample1").jqGrid({
			url:common_basePath+'autoForms/item!queryZCSampleByTaskId.action?taskId='+${flowtaskid},
			datatype: "json",
			height: 150,
			width: 720, 
			colNames:['主键','样品名称','样品编号','车辆名称','样品数量','批次号/规格型号','VIN号','应用车型','整车型号','车辆型号','生产商','设计乘员','整备质量','约定送样日期','样品处理','最高车','行驶里程','动力类型','附件'],
			colModel:[
				{name:'ID',index:'ID', width:70,key:true,hidden:true}, 
				{name:'T_SAMPLENAME',index:'T_SAMPLENAME', width:100}, 
				{name:'T_SAMPLENO',index:'T_SAMPLENO', width:140},
				{name:'CHELIANGNAME',index:'CHELIANGNAME', width:100,hidden:true}, 
				{name:'T_SAMPLECOUNT',index:'T_SAMPLECOUNT', width:40}, 
				{name:'T_PICI',index:'T_PICI', width:70}, 
				{name:'VIN',index:'VIN', width:70},
				{name:'T_YINGYONGCHEXING',index:'T_YINGYONGCHEXING', width:80}, 
				{name:'T_CHEXINGBIANMA',index:'T_CHEXINGBIANMA', width:70}, 
				{name:'CHELIANGXINGHAO',index:'CHELIANGXINGHAO', width:70,hidden:true}, 
				{name:'T_MANUFACTURER',index:'T_MANUFACTURER', width:70},
				{name:'CHENGYUAN',index:'CHENGYUAN', width:70},
				{name:'ZHENGBEIZHILIANG',index:'ZHENGBEIZHILIANG', width:70},
				{name:'T_SONGYANGDATE',index:'T_SONGYANGDATE', width:70},
				{name:'T_SAMPLECHULI',index:'T_SAMPLECHULI', width:70},
				{name:'ZUIGAOCHE',index:'ZUIGAOCHE', width:70},
				{name:'LICHENG',index:'LICHENG', width:70},
				{name:'DONGLILEIXING',index:'DONGLILEIXING', width:70},
				{name:'FILE_NAME',index:'FILE_NAME', width:180,hidden:true,hidedlg:false,formatter: function(cellvalue, options, rowObject) {        return "<a href='javascript:downloafAnnex(0,"+rowObject.T_ANNEX+")'>"+rowObject.FILE_NAME+"</a>" }}
			],   
			shrinkToFit:false,
			sortname:'ID',
			sortorder:'asc',
			viewrecords:true,
			multiselect: true, // 是否显示复选框
			multiboxonly : true, 
			rownumbers: false,//显示行号
		    cellEdit: false,
			forceFit : true, 
			rowNum:200,
			mtype: "POST", 
			rowList:[15,20,50,200,500],
			toolbar: [false,"top"],
			jsonReader: {
				root:"rows",		// 数据行（默认为：rows）
				page: "page",  	// 当前页
				total: "total",  // 总页数
				records: "records",  // 总记录数
				repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
			},
			prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
			pager:"#gridPagerSample",
			caption: "样品列表"
		});	    
        $("#gridTableItem1").jqGrid({
			url:common_basePath+'autoForms/item!queryItemByTaskId.action?type=&taskId='+${flowtaskid},
			datatype: "json",
			height: 150,
			width: 720, 
			colNames:['ID','检测项目','标准数量','标准委托','报告形式','报告要求','附件名称','检测费用','检测标准'],
			colModel:[
				{name:'ID',index:'ID', width:70,key:true,hidden:true}, 
				{name:'T_ITEMNAME',index:'T_ITEMNAME', width:180}, 
				{name:'bzcount',index:'bzcount', width:70,hidden:true}, 
				{name:'T_BIAOZHUNWEITUO',index:'T_BIAOZHUNWEITUO', width:80,editable: true,edittype:'select',editoptions:{value:'否:否;是:是'},formatter: function (cellvalue, options, rowObject) {
					if(rowObject.bzcount>0){ 
						biaozhunweituo='否';
						}else{ 
							biaozhunweituo='是';
						}
						return biaozhunweituo;
			       }},
				{name:'T_BAOGAOTYPE',index:'T_BAOGAOTYPE', width:100,editable:true,edittype:'select',editoptions:{value:'出具检测报告:出具检测报告;出具原始记录:出具原始记录',dataEvents:[        {type: 'change',fn: function(e) { 
					    var bgtype = $(this).val(); 
					    var rowid = $(this).parent().parent().attr('ID');
		         	if(bgtype=='出具原始记录'){ 
		                jQuery("#gridTableItem1").jqGrid('setRowData',rowid,{T_BGYAOQIU:''}); 	        }          	else if(bgtype=='出具检测报告'){
		                var msg = '<select class="editable" id="'+rowid+'_T_BGYAOQIU" submitName="T_BGYAOQIU" role="select" size="1"><option role="option" value="中文">中文</option><option role="option" value="英文">英文</option><option role="option" value="中英文">中英文</option></select>';                $("#gridTableItem1").jqGrid('setCell',rowid,'T_BGYAOQIU',msg);  	        }         }}]}}, 
				{name:'T_BGYAOQIU',index:'T_BGYAOQIU', width:80,editable: true,edittype:'select',editoptions:{value:'中文:中文;英文:英文;中英文:中英文'}}, 
		     {name:'FILE_NAME',index:'FILE_NAME', width:180,hidden:true,hidedlg:false,formatter: function(cellvalue, options, rowObject) {        return "<a href='javascript:downloafAnnex(0,"+rowObject.T_ANNEX+")'>"+rowObject.FILE_NAME+"</a>" }},		{name:'T_JIANCEMONEY',index:'T_JIANCEMONEY', width:80}, 
				{name:'T_JIANCEBIAOZHUN',index:'T_JIANCEBIAOZHUN', width:200} 
			],  
			shrinkToFit:false,
			sortname:'T_ITEMID',
			sortorder:'asc',
			viewrecords:true,
			multiselect: true, // 是否显示复选框
			multiboxonly : true, 
			rownumbers: false,//显示行号
		 cellEdit: false,
			forceFit : true, 
			rowNum:200,
			mtype: "POST", 
			rowList:[15,20,50,200,500],
			toolbar: [false,"top"],
			jsonReader: {
				root:"rows",		// 数据行（默认为：rows）
				page: "page",  	// 当前页
				total: "total",  // 总页数
				records: "records",  // 总记录数
				repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
			},
			prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
			pager:"#gridPagerItem1",
			caption: "检测项目列表"
		});
		      
        //提交  
		var options1 = {
	  	    url:'<%=request.getContextPath() %>/weituodan!chuliWeituodan.action',
	  	     beforeSubmit: function() {
	   				return checking();
	    			},
	  	    dataType:'json',
	  	    success: function(data) {
	  	    //alert(data);
	  	      if(data.result=='success'){
				alert("提交成功");
			//	window.close();
				api.close();
				W.reload();
	  	      }
	  	    }};
    	//提交
		$('#submitBtn').click(function(){
		    if("proc0"=="<%=request.getAttribute("stateid").toString()%>" &&  $("input[name='steptype']:checked").val()=="step4"){
				var ids = $("#gridTableItem1").jqGrid('getDataIDs')+"";
				var toArr = ids.split(",");
       		    for(var i = 0;i<toArr.length;i++){
                    var row = $("#gridTableItem1").jqGrid('getRowData',toArr[i]);
                    if(row.T_BIAOZHUNWEITUO=='是'){
                        alert("请没有标准的检测项目选择标准！");
                        return false;
                    }
	    	    }
			}
			if('<%=request.getAttribute("stateid").toString()%>'=='proc0' &&  $("input[name='steptype']:checked").val()=="step4"){
	    		 if(!checkFenpeiItemSample()){
    			     alert("该节点没有进行项目分配,不能提交!");
    			     return false;
    			   }
	    	}
	    	//退回填写退回意见和审批意见
	      var editbackoption = false;
	      if($('input[name="steptype"]:checked').val()=="step22" || $('input[name="steptype"]:checked').val()=="step23" || $('input[name="steptype"]:checked').val()=="step24"){ 
		     editbackoption = true;
		  }
		  if(editbackoption){
		        var datas = window.showModalDialog("<%=request.getContextPath() %>/workflow/viewBackOption.jsp", window, "dialogWidth:660px;status:no;dialogHeight:400px");
		    	if(typeof(datas) == 'undefined'){    
		    	   return false; 
				}else{
				      var json = eval('(' + datas + ')');
					  $("#backoption").val(json.remarks);
					  $("#spyj").val(json.remarks);
				}
		  }else{
			    //填写审批意见
			    var datas = window.showModalDialog("<%=request.getContextPath() %>/workflow/shenpiOption.jsp", window, "dialogWidth:660px;status:no;dialogHeight:400px");
		    	if(typeof(datas) == 'undefined'){  
		    	   return false;   
				}else{
				      var json = eval('(' + datas + ')');
					  $("#spyj").val(json.remarks);
				}
				
		  }
			if(!confirm("是否确认提交 ？")){
		   			return false;
				}
	    	$('#pageFrom').ajaxSubmit(options1);
	            return false;
    	 });
    	$('#closeBtn').click(function(){
    		api.close();
			W.reload();
		});
		
		
	});
	function checkFenpeiItemSample()
	    {
	          var flag = false;
	          $.ajax({  
	              url : '<%=request.getContextPath() %>/codeReviewActionNew!checkFenpeiItemSample.action?taskId=${flowtaskid}&flowtaskinfoid=<%=request.getAttribute("taskinfoid").toString()%>',  
	              type : "post", 
	              async: false,//取消异步提交 
	              dataType : "json",  
	              success : function(data, textStatus) {  
	             if(data.ajaxResult=="true")
	               {
	                flag = true;
	               }
	              }  
	         });
	         return flag;
	    }
   	function checking(){
   		var flag = true;
		var flowname = $.trim($("#flowname").val());
		var jiancedanwei = $("#jiancedanwei").val();
		var jiancedidian = $("#jiancedidian").val();
		var shenqingdanwei = $("#shenqingdanwei").val();
		var dizhi = $("#dizhi").val();
		var jiancemudi = $("#jiancemudi").val();
		if("proc0"=="<%=request.getAttribute("stateid").toString()%>"){
			var shuangfangyuedingdate = $("#shuangfangyuedingdate").val();
		}
		if(flowname ==null || flowname == "" ){
			alert("任务名称不能为空！");
			$("#flowname").focus();
    		return false;
		}
		if(jiancedanwei ==null || jiancedanwei == "" ){
			alert("检测单位不能为空！");
			$("#jiancedanwei").focus();
    		return false;
		}
		if(jiancedidian ==null || jiancedidian == "" ){
			alert("检测地点不能为空！");
			$("#jiancedidian").focus();
    		return false;
		}
		if(shenqingdanwei ==null || shenqingdanwei == "" ){
			alert("申请单位不能为空！");
			$("#shenqingdanwei").focus();
    		return false;
		}
		if(dizhi ==null || dizhi == "" ){
			alert("地址不能为空！");
			$("#dizhi").focus();
    		return false;
		}
		if(jiancemudi ==null || jiancemudi == "" ){
			alert("检测目的不能为空！");
			$("#jiancemudi").focus();
    		return false;
		}
		
		if("proc0"=="<%=request.getAttribute("stateid").toString()%>" &&  $("input[name='steptype']:checked").val()=="step4" && (shuangfangyuedingdate ==null || shuangfangyuedingdate == "") ){
			alert("双方约定日期不能为空！");
			$("#shuangfangyuedingdate").focus();
    		return false;
		}
		
	}
	 
	function checkExp(inputData){ 
		var regEx = new RegExp(/^(([^\^\.<>%&',:;=?$"'#@!~\]\[{}【】￥（）！·‘’”“。，、？：；—|\/\\/`\|])*)$/);
		var result = inputData.match(regEx);
		if (result == null) {
			return false;
		}
		return true;
	}
	function checkNum(inputData){
		var sNumber;
	    sNumber=Number(inputData);
	    if (isNaN(inputData)){
	       return false;
	     }
	    return true;
	}
	function countlen1(textarea){
	       var elem = event.relatedTarget || event.srcElement || event.target ||event.currentTarget;    
	        if(event.keyCode!=8)
			{
			  if (textarea.value.length> 249){
			        alert("最多为250个字符,字符输入超出限制!");
			        textarea.value=textarea.value.substring(0,249);
			    }
			    return true;
	 	    }
	}
		
	  //选择部门
	function selectdept(id)
	{
		var datas = window.showModalDialog("<%=request.getContextPath() %>/resource/choose/choose_organizationIndex.jsp?temp="+Math.round(Math.random()*10000),'',"dialogWidth=900px;dialogHeight=550px");
		if(typeof(datas) == 'undefined'){
		}else{
			var json1 = eval('(' + datas + ')');
			 document.getElementById("dept_"+id).value = json1.ORG_NAME;
			 document.getElementById(id).value = json1.ORG_ID;
		}
	}
	
	//选择人员
	function selectperson(id)
	{
		 var users = window.showModalDialog("<%=request.getContextPath() %>/resource/choose/chooseAllUser.jsp", window, "dialogWidth:900px;status:no;dialogHeight:500px");
    	if (users != null) {
    		var userIds = [];
            var userNames = [];
            for(var i=0;i<users.length;i++){
                userIds.push(users[i]['userid']);
                userNames.push(users[i]['username']);
            }
			    $("#"+id).val(userNames.join());
		     //   $("#"+id+"_id").val(userIds.join());
		   }
	}
	function changevalue(id){
	 	
	 	var flag = "0";
	 	if(id == 1){
	 		var fileValue = document.getElementById("file1").value;
	 		var a=fileValue.lastIndexOf("\\");
	 		var filename = fileValue.substring(a+1);
			document.getElementById("gongyingshangzizhi").value=filename;
			flag = "1";
		}else if(id == 2){
		    var fileValue = document.getElementById("file2").value;
	 		var a=fileValue.lastIndexOf("\\");
	 		var filename = fileValue.substring(a+1);
			document.getElementById("gongyingshangpingjia").value=filename;
			flag = "2";
		}
		document.getElementById("flag").value=flag;
	}
	//选择外键数据信息
	//参数信息：表明，关联列，显示列
	function selectData(id,tablename,colname,disname,cnname,fieldslist){
	    var fileColname ='hideFileName';
	    if(tablename=='DIC_STANDARD'){
	      fileColname = "YCLJS_GYYW";
	    }
		var datas = window.showModalDialog("<%=basePath%>/codeReviewActionNew!chooseDatalist.action?tablename="+tablename+"&colname="+colname+"&disname="+disname+"&cnname="+escape(encodeURIComponent(cnname))+"&fileColname="+fileColname+"&temp="+Math.round(Math.random()*10000),'',"dialogWidth=1000px;dialogHeight=400px");
		if(typeof(datas) == 'undefined'){
		}else{
			 var json1 = eval('(' + datas + ')');
	//		 document.getElementById(id).value = json1.ID;
			 var disnamearray = disname.split(',');
			 if(id == "jiancedanwei"){
			 	document.getElementById(id).value = json1[disnamearray[0]]+' ' +json1[disnamearray[1]];
			 	document.getElementById("dizhi").value = json1[disnamearray[2]];
			 }else{
			    document.getElementById(id).value = json1[disnamearray[0]];
			 }
			 
		}
	}
	function dahui(){
/*	    var datas = window.showModalDialog("<%=request.getContextPath() %>/view/zhengchekekaoxingshiyan_yijian.jsp",'',"dialogWidth=500px;dialogHeight=300px");
		    var json2 = eval('('+datas+')');
	    	if("close" == json2.state){
	    		return false;
	    	}else{
				var reg=new RegExp("<BR>","g"); 
				var remarkVal = remark.remark.replace(reg,"\n"); 
				$("#yijian").val(remarkVal);
	    	}*/
        var actionUrl = '<%=request.getContextPath()%>/weituodan!tuihuiWeituodan.action'; 
        var param = {
                      "flowname":$("#flowname").val(),
                      "flowid":"${flowid}",
                      "stateid":"${stateid}",
                      "steptypeback":$("#steptypeback0").val(),
                      "taskinfoid":"${taskinfoid}",
                      "gongyingshangId":$("#gongyingshangId").val(),
                      "weituodanid":$("#weituodanid").val()
            };
    	$.ajax({  
			        url : actionUrl,  
			        type : "post", 
			        data : param,  
			        dataType : "json",  
			        cache : false,  
			 error : function(textStatus, errorThrown) {  
			        alert("系统ajax交互错误: " + textStatus.value);  
		    },  
		    success : function(data, textStatus) {
		        if(data.ajaxResult=='success'){ 
		        //      window.returnValue = returnValue;     
				      alert("退回成功");
				      W.reload();
					  api.close();
                   }else{
                       alert("处理失败!");
                       W.reload();
                   }
		    }    
			});
    }
    //委外试验
    function weiwaishiyan(){
        if(!confirm("是否确认委外试验 ？")){
		   return false;
		}
    	var actionUrl = '<%=request.getContextPath()%>/weituodan!weiwaishiyan.action'; 
        var param = {
                      "flowname":$("#flowname").val(),
                      "flowid":"${flowid}",
                      "stateid":"${stateid}",
                      "steptype":$("#steptype1").val(),
                      "taskinfoid":"${taskinfoid}",
                      "gongyingshangId":$("#gongyingshangId").val(),
                      "weituodanid":$("#weituodanid").val(),
                      "weituodanshibieno":$("#weituodanshibieno").val(),
                      "feiyongzongji":$("#feiyongzongji").val()
            };
    	$.ajax({  
			        url : actionUrl,  
			        type : "post", 
			        data : param,  
			        dataType : "json",  
			        cache : false,  
			 error : function(textStatus, errorThrown) {  
			        alert("系统ajax交互错误: " + textStatus.value);  
		    },  
		    success : function(data, textStatus) {
		        if(data.result=='success'){ 
		        //      window.returnValue = returnValue;     
				      alert("提交成功");
				      W.reload();
					  api.close();
                   }else{
                       alert("处理失败!");
                       W.reload();
                   }
		    }    
			});
    }
    //生成样品编号
    function shengchengyangpinno(){
    	var actionUrl2 = '<%=request.getContextPath()%>/weituodan!shengchengyangpinNo.action'; 
        var param = {
                      "flowtaskid":${flowtaskid},
                      "weituodanshibieno":$("#weituodanshibieno").val()
            };
    	$.ajax({  
			        url : actionUrl2,  
			        type : "post", 
			        data : param,  
			        dataType : "json",  
			        cache : false,  
			 error : function(textStatus, errorThrown) {  
			        alert("系统ajax交互错误: " + textStatus.value);  
		    },  
		    success : function(data, textStatus) {
		        if(data.result=='success'){ 
		        //      window.returnValue = returnValue;     
				//      alert("处理成功");
				      gridSearchSample(${flowtaskid});
                   }else{
                //       alert("处理失败!");
                   }
		    }    
			});
    }
    //刷新样品列表
   function gridSearchSample(flowtaskid){
        jQuery("#gridTableSample1").jqGrid('setGridParam',
              {
                  url:'<%=request.getContextPath() %>/autoForms/item!queryZCSampleByTaskId.action?taskId='+flowtaskid
              }).trigger("reloadGrid", [{page:1}]); 
   }
   //项目分配
   function fenpeiItem(){
       if("proc0"=="<%=request.getAttribute("stateid").toString()%>" &&  $("input[name='steptype']:checked").val()=="step4"){
			var ids = $("#gridTableItem1").jqGrid('getDataIDs')+"";
			var toArr = ids.split(",");
      		    for(var i = 0;i<toArr.length;i++){
                   var row = $("#gridTableItem1").jqGrid('getRowData',toArr[i]);
                   if(row.T_BIAOZHUNWEITUO=='是'){
                       alert("请没有标准的检测项目选择标准！");
                       return false;
                   }
    	    }
		}
		if("proc0"=="<%=request.getAttribute("stateid").toString()%>" &&  $("input[name='steptype']:checked").val()=="step4"){
			var ids = $("#gridTableSample1").jqGrid('getDataIDs')+"";
			var toArr = ids.split(",");
      		    for(var i = 0;i<toArr.length;i++){
                   var row = $("#gridTableSample1").jqGrid('getRowData',toArr[i]);
                   if(row.T_SAMPLENO=='' || row.T_SAMPLENO==null || row.T_SAMPLENO=='undefined'){
                       alert("请先生产样品编号再进行项目分配！");
                       return false;
                   }
    	    }
		}
       var sampleIds = jQuery("#gridTableSample1").jqGrid('getDataIDs')+""; //样品列表ID
       $.dialog({
	        title: '项目分配',
	        content: 'url:<%=request.getContextPath() %>/workflow/changguijiance_fenpeiitem.jsp?flag=1&taskId=${flowtaskid}&sampleIds='+sampleIds+'&flowtaskinfoid=${taskinfoid}&stateid=${stateid}',
	        zIndex:2001,
	        okVal: false,//确定按钮文字
	        cancelVal: false,//取消按钮文字
	        min: true, //是否显示最小化按钮
	        max: false,//是否显示最大化按钮
	        fixed: false,//开启静止定位
	        lock: true,//开启锁屏
	        focus: true,//弹出窗口后是否自动获取焦点（4.2.0新增）
	        time: null,//设置对话框显示时间
	        resize: true,//是否允许用户调节尺寸
	        drag: true,//是否允许用户拖动位置
	        cache: false,//是否缓存iframe方式加载的窗口内容页
	        width: '980px',
	        height: 570,
	        close:function(){
	        	window.location.reload();
	        }
		});
   
   }
   //调度审核委托单 修改检测标准
   function updateJiancebiaozhun(){
   
        var ids= $("#gridTableItem1").jqGrid("getGridParam", "selarrrow") + "";
		if (!ids) {
		    alert("请先选择记录!");  
		    return false;  
		}
		if(ids.indexOf(",")!=-1){
			 alert("只能选择一条记录!");  
		    return false; 
		}
	   var row = jQuery("#gridTableItem1").jqGrid('getRowData',ids);//获取选中行.
	   if(row.T_BIAOZHUNWEITUO=='否'){
	     alert("请选择标准委托为是的数据!");
	     return false;
	   }
	   var datas = window.showModalDialog("<%=request.getContextPath() %>/workflow/choose_changgui_jiancebiaozhun.jsp?itemId="+row.ID+"&taskId=${flowtaskid}&temp="+Math.round(Math.random()*10000), window, "dialogWidth:980px;status:no;dialogHeight:450px");
	   gridSearchItemGrid();		
       
   }
   //刷新检测项目列表
   function gridSearchItemGrid(){
        jQuery("#gridTableItem1").jqGrid('setGridParam',
              {
                  url:'<%=request.getContextPath() %>/autoForms/item!queryItemByTaskId.action?type=&taskId='+${flowtaskid}
              }).trigger("reloadGrid", [{page:1}]); 
   }

   </script>
 	<style type="text/css">
 		body{
 			background:#ffffff; background-image:url(images/);
 		}
   		html{
		    overflow-x: hidden;
			overflow-y: hidden;
		}  	
		.formTableNew textarea{border: 1px solid #999;padding: 5px;width: 760px;-moz-border-radius: 3px;border-radius: 3px;margin-bottom: 5px;color: #666;background: url(../images/input_bg.gif) repeat-x top;}
   </style>
  </head>
  
  <body style="overflow-y: scroll;">
<form id="pageFrom" action="" enctype="multipart/form-data" method="post">
        <input type="hidden" name="flowid" id="flowid" value="${flowid}">
     	<input type="hidden" name="stateid" id="stateid" value="${stateid}">
     	<input type="hidden" name="taskinfoid" id="taskinfoid" value="${taskinfoid}">
  		<input type="hidden" id="spyj" name="spyj" value="" />
  		<input type="hidden" id="backoption" name="backoption" value="" />
  		<input type="hidden" id="weituodanid" name="weituodanid" value="${weituodan.ID}" />
  		<input type="hidden" id="flowtaskid" name="flowtaskid" value="${flowtaskid}" />
     	<input type="hidden" id="bianzhirenyuan" name="bianzhirenyuan" value="${weituodan.BIANZHIRENYUAN}" />
     	<input type="hidden" id="pizhunrenyuan" name="pizhunrenyuan" value="${weituodan.PIZHUNRENYUAN}" />
     	<input type="hidden" id="jieshoufangdaibiao" name="jieshoufangdaibiao" value="${weituodan.JIESHOUFANGDAIBIAO}" />
  		<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
  			<tr>
  			  <tr>
  		    	<td align="right">流程名称：</td>
  		    	<td colspan="3" align="left">
	  			    <input  type="text" readonly id="flowname" maxlength="50" name="flowname" style="border: 1px solid #999;padding: 5px;width: 738px;"  value="${flowname }" />
  			    </td>
  		    </tr>
  			  <td align="right">任务名称：</td>
  			  <td align="left">
  			    <input  type="text" readonly id="renwuname" maxlength="50" name="renwuname" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.RENWUNAME}" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">检测单位：</td>
  			   <td align="left">
  			    <input  type="text" readonly id="jiancedanwei" name="jiancedanwei" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.JIANCEDANWEI}" />
  			   	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			   </td>
  			</tr>
  			<tr>
  			  <td align="right">检测地点：</td>
  			  <td align="left">
  			    <input  type="text" readonly id="jiancedidian" name="jiancedidian" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.JIANCEDIDIAN}" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">申请单位：</td>
  			   <td align="left">
  			    <input  type="text" readonly id="shenqingdanwei" maxlength="50" name="shenqingdanwei" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.SHENQINGDANWEI}" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			   </td>
  			</tr>
  			<tr>
  			  <td align="right">联系人：</td>
  			  <td align="left">
  			  	 <input  type="text"  id="lianxiren" readonly name="lianxiren" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.LIANXIREN}" />
  			     <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">申请日期：</td>
  			  <td align="left">
  			    <input  type="text"  id="shenqingdate" readonly maxlength="50"  name="shenqingdate" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.SHENQINGDATE}" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">联系电话：</td>
  			  <td align="left">
  			    <input  type="text" readonly id="lianxidianhua" maxlength="50"  name="lianxidianhua" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.LIANXIDIANHUA}" />
  			  </td>
  			  <td align="right">地址：</td>
  			  <td align="left">
  			     <input  type="text" readonly id="dizhi" maxlength="50" name="dizhi" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.DIZHI}" />
  			     <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">邮编：</td>
  			  <td align="left">
  			    <input  type="text" readonly id="youbian" maxlength="50"  name="youbian" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.YOUBIAN}" />
  			  </td>
  			  <td align="right">检测目的：</td>
  			  <td align="left">
  			     <input  type="text" readonly id="jiancemudi" maxlength="50" name="jiancemudi" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.JIANCEMUDI}" />
  			     <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			<%if(!"gcjd".equals(request.getAttribute("stateid").toString())){ %>
  			  <td align="right">双方约定日期：</td>
  			  <td align="left">
  			    <input  type="text" readonly id="shuangfangyuedingdate" maxlength="50"  name="shuangfangyuedingdate" onClick="WdatePicker()" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.SHUANGFANGYUEDINGDATE}" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">费用总计：</td>
  			  <td align="left">
  			    <input  type="text" readonly id="feiyongzongji" maxlength="50" name="feiyongzongji" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodan.FEIYONGZONGJI}" />
  			  </td>
  			  <%}%>
  			</tr>
  			<%if(!"gcjd".equals(request.getAttribute("stateid").toString())){ %>
  			<tr>
  				<td align="right">委托单识别号：</td>
  			  <td align="left">
  			    <input  type="text" readonly id="weituodanshibieno" maxlength="50" name="weituodanshibieno" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="${weituodanshibieno}" />
  			  </td>
  			  <td align="right">&nbsp;</td>
  			  <td align="left">&nbsp;</td>
  			</tr>
  			<%} %>
 			<tr>
		    <td align="right"  >项目特殊说明：</td>
		    <td >
		    	<div class="div">
					<textarea rows="5" cols="100" id="xiangmuteshushuoming" name="xiangmuteshushuoming" onkeydown="countlen1(this);" style="width: 250px;">${weituodan.XIANGMUTESHUSHUOMING}</textarea>
				</div>	
		    </td>
		    <td align="right"  >样品特殊说明：</td>
		    <td>
		    	<div class="div">
					<textarea rows="5" cols="100" id="yangpinteshushuoming" name="yangpinteshushuoming" onkeydown="countlen1(this);" style="width: 250px;">${weituodan.YANGPINTESHUSHUOMING}</textarea>
				</div>	
		    </td>
		  </tr>
		  <tr>
		  	  <td align="right">项目附件：</td>
  			  <td align="left">
  			    <jsp:include page="../fileupload/attachment.jsp?id=${weituodan.ID }&column=xiangmu&show=y" ></jsp:include>
  			  </td>
  			  <td align="right">样品附件：</td>
  			  <td align="left">
  			    <jsp:include page="../fileupload/attachment.jsp?id=${weituodan.ID }&column=yangpin&show=y" ></jsp:include>
  			  </td>
		  </tr>
		  <!--tr>
		  	<td align="right">审批意见：</td>
		  	<td colspan='3'><textarea id=\"shenpiyijian\" name=\"shenpiyijian\"    class='ftextarea' readonly=\"readonly\" rospan=\"8\" colspan=\"80\" style='border: 1px solid #999;padding: 5px;width:740px;height:60px'>${spyj}</textarea></td>
		  </tr-->
		  <tr>
		    <td colspan='4' align='center'>
		      <div id='tt1' class='easyui-tabs' style='width:750px;height：600px'>
		        <div title='样       品' style='padding:10px'>
		        <%if("proc0".equals(request.getAttribute("stateid").toString())){ %>
		          <!--input id='saveBtn1' type='button'  value='生成样品编号' onclick="shengchengyangpinno()" /-->
		        <%} %>
                  <table id="gridTableSample1"></table>
                 <div id="gridPagerSample"></div></div>
                 <div title='检测项目' style='padding:10px'>
                 <%if("proc0".equals(request.getAttribute("stateid").toString())){ %>
                   <input type='button' value='选择检测标准' onclick="updateJiancebiaozhun()" class='form_bt_orange'  style='width:120px;'/>
                 <%}%>
                  <table id="gridTableItem1"></table>
                  <div id="gridPagerItem1"></div>
				 </div>
			</td></tr>
			<tr><td align="right">下一步骤：</td>
			    <td colspan="3">${steptcontent}</td>
			</tr>
		</table>
		<table width="100%" border="0" align="center" class="formTableNew">
		  <tr>
			<td align="center">
			
			<%if("proc0".equals(request.getAttribute("stateid").toString())){ %>
			    <!-- 第三节点 调度员审核/分配科室-->
			    <!--input id="saveBtn1" onclick="weiwaishiyan()" type="button" value="委外试验" class="form_bt_orange" /-->
			    <input id="saveBtn2" onclick="fenpeiItem()" type="button" value="项目分配" class="form_bt_orange" style="width:100px"/>
			    <!--input id="saveBtn2" onclick="" type="button" value="样品标识卡" class="form_bt_orange" style="width:120px"/-->
				<input id="saveBtn" type="button" value="保 存" class="form_bt_orange" />
				<input id="submitBtn" type="button" value="提 交" class="form_bt_orange" />
				<input type="button" id="closeBtn" value="取 消" class="form_bt_grey" />
			<%}else{ %>
		    	<input id="submitBtn" type="button" value="提 交" class="form_bt_orange" />
		    	<!--input type="button" id="backBtn" onclick="dahui()" value="退 回" class="form_bt_orange" /-->
		    	<input type="button" id="closeBtn" value="取 消" class="form_bt_grey" />
		    <%} %>
		    </td>
		  </tr>
		  <tr>
		  	<td>&nbsp;&nbsp; </td>
		  </tr>
		</table>
	<!--表单结束-->
	</form>
  </body>
</html>
